//
//  M3U8DownloadManage.h
//  LocalHttpServerExample
//
//  Created by Lin Eidan on 13-9-6.
//  Copyright (c) 2013年 taomee. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "SegmentDownloadManage.h"

@class DownloadGetData;
@class VideoObj;
@class M3U8Handle;

@protocol M3U8DownloadManageDelegate;

@interface M3U8DownloadManage : NSObject<SegmentDownloadManageDelegate>

@property(strong, nonatomic) NSString *contentId;
@property(strong, nonatomic) NSString *episodeId;
@property(assign, nonatomic) int curNum;
@property(assign, nonatomic) float totalDur;
@property(strong, nonatomic) VideoObj *VideoObj;

@property(assign, nonatomic) float hasDownloadDur;
@property(assign, nonatomic) float hasFailedDur;
@property(assign, nonatomic) int retryTime;

@property(strong, nonatomic) NSArray *segmentsArray;
@property(strong, nonatomic) NSString *saveToPath;
@property(strong, nonatomic) NSMutableArray *downloadArray;
@property(weak, nonatomic) id<M3U8DownloadManageDelegate>delegate;


-(id)initWithM3U8Handle:(M3U8Handle *)m3u8Handle andVideoObj:(VideoObj *)obj;
-(void)startDownloadVideo;
-(void)pauseDownloadVideo;

@end

@protocol M3U8DownloadManageDelegate <NSObject>

@optional
-(void)m3U8DownloadManage:(M3U8DownloadManage *)m3U8DownloadManage andAllSegmentsHasDownloadPer:(float)per andVideoObj:(VideoObj *)VideoObj;
-(void)m3U8DownloadManageAllSegmentsHasDownloadSuccessed:(M3U8DownloadManage *)m3U8DownloadManage andVideoObj:(VideoObj *)VideoObj;
-(void)m3U8DownloadManageAllSegmentsHasDownloadFailed:(M3U8DownloadManage *)m3U8DownloadManage andVideoObj:(VideoObj *)VideoObj;

@end
